<template>
<div>
  <el-button @click="requestGet">Get请求</el-button>
  <el-button @click="requestPost">Post请求</el-button>
  <el-button @click="request05">请求05</el-button>
</div>
</template>

<script>
export default {
  name: "Axios02",
  methods: {
    requestGet() {
      // 如果没有指定baseURL, 则每次请求都需要指定http://IP:端口/
      http.get('/api/03/奔驰/SUV').then((response) => {
        console.log(response)
      })
    },
    requestPost() {
      http.post('/api/04', {
        username:'张飞',
        password:'123456'
      }).then((response) => {
            this.$alert(response.data)
      })
    },
    request05() {
      this.$http.get('/api/09', {
        params: {
          username:'张飞',
          password:'12345'
        }
      }).then((response)=>{
        this.$alert(response.data)
      })
    }
  }
}
</script>

<style scoped>

</style>